#pragma once

#include "Types.h"
#include "DLL.h"
#include "Action.h"
#include <MyFC/Event.h>

namespace My {

class Segment : public EventDispatcher
{
public:
	virtual ~Segment() { }
public:
	virtual int GetOrigin() const = 0;
	virtual Span GetTimeSpan() const = 0;
	virtual void SetTimeSpan(Span) = 0;
	virtual Span GetDataSpan() const = 0;
	virtual bool IsProcessed() const = 0;
	virtual bool NeedsProcessing() const = 0;
	virtual bool StartProcessing() = 0;
	virtual void CancelProcessing(bool Wait) = 0; ///< if not Wait it may return before processing is really stopped
	virtual bool IsMaskEditing() const = 0;
	virtual void OpenMaskEditor() = 0;
	virtual void CloseMaskEditor() = 0;
	/// Called before removal
	virtual void Release() = 0;
public:
	class Event : public My::Event {
	public:
		Segment &	m_Segment;
		Event(Segment & s) : m_Segment(s) { }
	};
	class TimeSpanChange : public Event {
	public:
		TimeSpanChange(Segment & s) : Event(s) { }
	};
	class DataSpanChange : public Event {
	public:
		DataSpanChange(Segment & s) : Event(s) { }
	};
	class StateChange : public Event {
	public:
		StateChange(Segment & s) : Event(s) { }
	};
};

} // My
